package com.cxx.purchasecharge.core.model.persistence;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.cxx.purchasecharge.core.model.BaseModel;

/**
 * 联系人分类，如特别重要、重要、普通、不重要、失效等
 */
@Entity
@Table (name = "pc_contact_type")
public class ContactType extends BaseModel
{
    private static final long serialVersionUID = 1L;

    private long id;
    private String name;

    private List <Contact> contacts;

    public ContactType ()
    {
    }

    public ContactType (String name)
    {
        this.name = name;
    }

    @Id
    @GeneratedValue (strategy = GenerationType.AUTO)
    public long getId ()
    {
        return id;
    }

    public void setId (long id)
    {
        this.id = id;
    }

    @Column (nullable = false, unique = true)
    public String getName ()
    {
        return name;
    }

    public void setName (String name)
    {
        this.name = name;
    }

    @OneToMany (mappedBy = "type")
    public List <Contact> getContacts ()
    {
        return contacts;
    }

    public void setContacts (List <Contact> contacts)
    {
        this.contacts = contacts;
    }

}
